#ifndef SYSOPTION_H
#define SYSOPTION_H

#include <QWidget>
#include <QtSerialPort>
#include "appConfig.h"
#include <dialog.h>
#include <QTimer>
#include <QLineEdit>

namespace Ui {
class sysOption;
}

class sysOption : public QWidget
{
    Q_OBJECT

public:
    sysOption(QWidget *parent = nullptr,QSerialPort * mPort = nullptr);
    QWidget * meWidget = nullptr;
    QSerialPort * port = nullptr;
    QTimer * waitReadTimer = nullptr;
    QTimer * autoGetSysFlashTimer = nullptr;

    void portInit(void);
    bool portConfig(bool status);   //打开和关闭
    uint8_t checkXOR(char *data, int length);
    void procPortData(uint8_t * data,uint32_t len);
    void show(void){
        meWidget->show();
    }
    void hide(void){
         meWidget->hide();
    }
    Dialog * checkLog = nullptr;
    ~sysOption();
signals:
    void setPortStatus(bool status);
    void setStatusMessage(QString text);
    void updateSysData(void);
    void WaitMs(int ms);
    void writeLogText();
private slots:
    void on_pushButton_2_clicked();

    void on_pushButton_clicked();

    void serialPortReadyRead();

    void on_pushButton_5_clicked();

    void on_comboBox_5_currentIndexChanged(int index);

    void on_pushButton_9_clicked();

    void on_pushButton_3_clicked();

    void waitReadTimerTimeOut(void);

    void lineEditM2ReturnPressed();

    void lineEditM1ReturnPressed();
    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_horizontalSlider_2_valueChanged(int value);

    void on_pushButton_10_clicked();

    void montorStop(void);

    void on_autoGetSysFlashTimer_timeout(void);

private:
    Ui::sysOption *ui;
};

#endif // SYSOPTION_H
